<?php
class IndexModel extends Model {

	public function getNewsItems() {
		$news = array();
		$result = $this->selectAllIds('news');
		if(!$result) {
			return false;
		}
		foreach ($result as $row) {
			$news[] = new NewsItem($row->id);
		}
		return $news;
	}

	public function getVisibleNewsItems() {
		$news = array();
		$result = $this->selectAllIds('news', 'visible = 1 ORDER BY `date_add` DESC');
		if(!$result) {
			return false;
		}
		foreach ($result as $row) {
			$news[] = new NewsItem($row->id);
		}
		return $news;
	}
}